<template>
  <div class="rightdiv">
    <span
      class="corner corner-left-top"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-right-top"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-left-bottom"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-right-bottom"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <div id="chart_right_top" style="width: 100%; height: 300px"></div>
  </div>
</template>
<script>
import * as echarts from "echarts";
export default {
  data() {
    return {};
  },
  mounted() {
    this.myChart = echarts.init(document.getElementById("chart_right_top"));
    this.initChart();
    window.addEventListener("resize", function () {
      this.myChart.resize();
    });
  },
  methods: {
    initChart() {
      let option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "center",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 40,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: "Search Engine" },
              { value: 735, name: "Direct" },
              { value: 580, name: "Email" },
              { value: 484, name: "Union Ads" },
              { value: 300, name: "Video Ads" },
            ],
          },
        ],
      };
      this.myChart.setOption(option);
    },
  },
};
</script>
<style scoped>
.rightdiv {
  position: relative;
}
.corner {
  position: absolute;
  background-color: transparent;
}
.corner-left-top {
  left: -1px;
  top: -1px;
  border-right: transparent !important;
  border-bottom: transparent !important;
}
.corner-right-top {
  right: -1px;
  top: -1px;
  border-left: transparent !important;
  border-bottom: transparent !important;
}
.corner-left-bottom {
  left: -1px;
  bottom: -1px;
  border-right: transparent !important;
  border-top: transparent !important;
}
.corner-right-bottom {
  right: -1px;
  bottom: -1px;
  border-left: transparent !important;
  border-top: transparent !important;
}
</style>